<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>

<script type="text/javascript" src="<c:url value='/common/js/jquery-1.7.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-ui-1.8.16.custom.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-popup.0.2.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/ajaxupload.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/Common.js'/>"></script>
</head>
<script language="javascript">



function extFncLogin() {
    
    var frm = $("#extLoginMbrForm")[0];

    // frm.action="<c:url value='/mbr/login.do'/>";

    //frm.submit();
    var loginMsg = document.getElementById("loginMsg");
    var extId = frm.extId.value ;

    var extPw = frm.extPw.value ;
    if(extId ==""){
        alert("아이디를 입력하세요");
        frm.extId.focus();
        return ;
    }
    
    if(extPw ==""){
        alert("비밀번호를 입력하세요");
        frm.extPw.focus();
        return ;
    }

       $.post("<c:url value='/mbr/extFnLogin.do'/>",
               {
                   'extMbrId' : extId,
                   'extPw'     : extPw
               },
               function(data){
                   var result={};
                   var items = $(data).find("item");
                   items.each(function(index,element){
                      var name = $(this).find("name").text();
                      var value = $(this).find("value").text();
                      result[name] = value;
                   });
                   if(result["result"] =="OK"){
                 
                       var frm = $("#extLoginMbrForm")[0];
                       frm.action="<c:url value='/mbr/extClasAgr.do'/>";
                      frm.submit();
                       return true;
                   }else if(result["result"] =="ChgY"){
                       alert("이미 회원 전환된 아이디입니다.\n전환된 신회원제 아이디는 이메일입니다");
                       return false;
                   }
                   else{
              
                       loginMsg.innerHTML="<font color=\"red\">아이디나 비밀번호를 다시 확인하여 주세요.</font>";

                       return true;                      
                   }
                       
               }  
           );  

 return false;


}


function extIdFindAction()
{

    var idFindMsg = document.getElementById("idFindMsg");
    
   var mbrNm = document.getElementById("mbrNm");

   
   if(mbrNm.value ==""){
       alert("성명을 입력하십시요");
       mbrNm.focus();
       return ;
   }
    var mobileCom = document.getElementById("mobileCom");
    var telPrx = document.getElementById("telPrx");
    if(telPrx.value ==""){
        alert("전화번호 앞자리를  입력하십시요");
        telPrx.focus();
        return ;
    }    
    var telTail = document.getElementById("telTail");
    if(telTail.value ==""){
        alert("전화번호 뒷자리를  입력하십시요");
        telTail.focus();
        return ;
    }
    var hpNo = mobileCom.value + '-' + telPrx.value + '-' +  telTail.value ;
    

    var frm = $("#extLoginMbrForm")[0];
    
    $.post("<c:url value='/mbr/extIdFind.do'/>",
            {
                'extName' : mbrNm.value,
                'extTelHome'     : hpNo
            },
            function(data){
          
                var result={};
                var items = $(data).find("item");
                items.each(function(index,element){
                   var name = $(this).find("name").text();
                   var value = $(this).find("value").text();
                   result[name] = value;
                });
                telPrx.value = "";
                telTail.value = "";
                mbrNm.value = "";
                if(result["result"] !="NON"){
              
                    loginMsg.innerHTML="";
                    var extId = result["result"];
  
                    idFindMsg.innerHTML = "고객님의 아이디는 " + extId + "입니다";
                    $("#idfindpopup").hide();
                    $("#idfindpopup02").show();
                    return true;
                }
                else {
                

                    idFindMsg.innerHTML = "고객님의 아이디는 존재하지 않습니다.";
                    $("#idfindpopup").hide();
                    $("#idfindpopup02").show();
                    return true;
                }    
            }  
        );  

     
 }
 
function extPwFindAction()
{

    var pwFindMsg = document.getElementById("pwFindMsg");
    
   var findExtMbrId = document.getElementById("findExtMbrId");
   

   var mbrEmlPrx = document.getElementById("extMbrEmlPrx");
   var mbrEmlTail = document.getElementById("extMbrEmlTail");
   var selEmlTail = document.getElementById("selectEmlTail");
   
   
   
   
   if(findExtMbrId.value ==""){
       alert("아이디 입력하십시요");
       findExtMbrId.focus();
       return ;
   }


    
    if (mbrEmlPrx.value == "") {
        alert("이메일 아이디를 입력하십시요");
        mbrEmlPrx.focus();
        return ;
    }    
    if ((selEmlTail.value == "" ) && (mbrEmlTail.value == "")) {
        alert("이메일 제공회사를 입력하십시요");
        mbrEmlTail.focus();
        return ;
    }     

    
    
    
    var mbrEml = mbrEmlPrx.value +"@" +  mbrEmlTail.value  ; 
    
    var frm = $("#extLoginMbrForm")[0];
    
    $.post("<c:url value='/mbr/extPwFind.do'/>",
            {
                'extMbrId' : findExtMbrId.value,
                'extMbrEml'     : mbrEml
            },
            function(data){
          
                var result={};
                var items = $(data).find("item");
                items.each(function(index,element){
                   var name = $(this).find("name").text();
                   var value = $(this).find("value").text();
                   result[name] = value;
                });

                if(result["result"] !="NON"){
              
                    pwFindMsg.innerHTML="";
                    var extId = result["result"];
                

                    pwFindMsg.innerHTML = "고객님의 이메일로 임시비밀번호를 발송하였습니다.";
                    $("#pwfindpopup").hide();
                    $("#pwfindpopup02").show();
                    return true;
                }
                else {
                

                    pwFindMsg.innerHTML = "고객님의 정보가 일치하지 않습니다.";
                    $("#pwfindpopup").hide();
                    $("#pwfindpopup02").show();
                    return true;
                }    
            }  
        );  

     
 } 
 


function dataLengthCheck(maxLen,obj)
{
    var str= obj.value;
    var cntHan;
    
    cntHan = (escape(str)+"%u").match(/%u/g).length-1;
    
    if(maxLen < (str.length + cntHan))
    {
        alert("총 영숫자  [" + maxLen + "]자, 한글  [" + parseInt(maxLen/2) + "]자 까지 사용하실 수 있습니다. " );
        //입력한 값을 maxLen 길이로 자르기
        while(maxLen < str.length + cntHan)
        {
            str = str.substring(0,str.length-1);
            cntHan = (escape(str)+"%u").match(/%u/g).length-1;
        }
        obj.value = str;
        obj.focus();
        return  false;

  }    
   return true;
    
    
    
}

function numbersOnly(obj)
{
    var str = obj.value;
   
    if(str.length > 0)
    {
        if(isNaN(str) == true )
        {
            alert("숫자만 입력 가능합니다");
            obj.value = "";
            return false;
        }    
    }
    
    return true;
    
}


function svrcomChg(){
    

    
    
    var svrcom =  document.getElementById("selectEmlTail");


    
  
    if(svrcom.value == "")
    {  //직접입력의 경우 이메일제공회사를 입력한 후에 아이디 체크가 이루어 져야한다.
        document.getElementById("extMbrEmlTail").value = "";
        document.getElementById("extMbrEmlTail").disabled = false;
        document.getElementById("extMbrEmlTail").focus();
    }
    else 
    {
        document.getElementById("extMbrEmlTail").value = svrcom.value;
        document.getElementById("extMbrEmlTail").disabled = true;

    }


}
</script>
<body>
        <form id="extLoginMbrForm" name="extLoginMbrForm" method="post" onsubmit="return false;">


<div id="idfindpopup" class="layerpopup idfindpopup"><div class="layerpopup-inner">
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_idfind.gif" alt="아이디찾기" /></h1>
        <p class="desc"><img src="/kr/images/layerpopup/h1_idfind_desc.gif" alt="이벤트 응모 및 경품 수령 등을 위한 고객님의 정확한 정보를 확인, 입력해 주세요." /></p>
    </div>
    <div class="layerpopup-contents">
        <div class="person-info-wrap">
            <div class="person-info">
                <table summary="">
                <colgroup>
                    <col width="25%" />
                    <col />
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row"><img src="/kr/images/layerpopup/txt_person_info01.png" alt="성명" /></th>
                    <td class="input">
                        <input type="text" class="txt" style="width:194px" value="" id="mbrNm" name="mbrNm" />
                    </td>
                </tr>
                <tr>
                    <th scope="row"><img src="/kr/images/layerpopup/txt_person_info02.png" alt="휴대폰 번호" /></th>
                    <td class="input">
                        <select class="select select-type1" style="width:56px;" name="mobileCom" id="mobileCom">
                            <option value="010" selected>010</option>
                            <option value="011">011</option>
                            <option value="016">016</option>
                            <option value="017">017</option>
                            <option value="018">018</option>
                            <option value="019">019</option>
                         
                        </select>
                        -
                        <input type="text" class="txt" style="width:61px;" title="앞자리 입력" maxlength="4" name="telPrx" id="telPrx" onKeyup="numbersOnly(this)" />
                        -
                        <input type="text" class="txt" style="width:61px;" title="뒷자리 입력"  ass="txt" style="width:61px;" maxlength="4" name="telTail" id="telTail" onKeyup="numbersOnly(this)"/>
                    </td>
                </tr>
                </tbody>
                </table>
            </div>
        </div>
        <div class="btnwrap">
            <a href="#"><img src="/kr/images/layerpopup/btn_confirm04.gif" alt="확인" onClick="extIdFindAction()" /></a>
        </div>
    </div>
    <!-- close -->
    <div class="close-area"><div class="close-area-inner">
        <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
    </div></div>
    <!-- //close -->
</div></div>
   

<div id="idfindpopup02" class="layerpopup idfindpopup"><div class="layerpopup-inner">
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_idfind.gif" alt="아이디찾기" /></h1>
        <p class="desc"><img src="/kr/images/layerpopup/h1_idfind_desc02.gif" alt="회원님의 아이디는 아래와 같습니다." /></p>
    </div>
    <div class="layerpopup-contents">
        <div class="person-info-wrap">
            <p class="idfind-result" name="idFindMsg" id="idFindMsg">
               
            </p>
            <p class="subsection04"><img src="/kr/images/layerpopup/txt_idfind01.gif" alt="고객님의 개인정보는 항상 암호화 되어 처리되며, 본인 확인용으로만 사용합니다. 아이디/비밀번호 찾기가 위의 방법으로 불가능하신 경우 고객센터 (080-600-6000) 로 문의해 주시기 바랍니다." /></p>
        </div>
        <div class="btnwrap">
            <a href="#"><img src="/kr/images/layerpopup/btn_confirm04.gif" alt="확인" class="close"/></a>
        </div>
    </div>
    <!-- close -->
    <div class="close-area"><div class="close-area-inner">
        <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
    </div></div>
    <!-- //close -->
</div></div>

 

<div id="pwfindpopup" class="layerpopup pwfindpopup"><div class="layerpopup-inner">
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_pwfind.gif" alt="비밀번호 찾기" /></h1>
        <p class="desc"><img src="/kr/images/layerpopup/h1_pwfind_desc.gif" alt="회원 아이디, 이메일 주소가 모두 일치하는 경우 해당 메일로 임시 비밀번호를 발급해 드립니다." /></p>
    </div>
    <div class="layerpopup-contents">
        <div class="person-info-wrap">
            <div class="person-info">
                <table summary="">
                <colgroup>
                    <col width="25%" />
                    <col />
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row"><img src="/kr/images/layerpopup/txt_pwfind01.png" alt="아이디" /></th>
                    <td class="input">
                        <input type="text" class="txt" style="width:194px" name="findExtMbrId" id="findExtMbrId"/>
                    </td>
                </tr>
                <tr>
                    <th scope="row"><img src="/kr/images/layerpopup/txt_pwfind02.png" alt="이메일" /></th>
                    <td class="input">
                        <input type="text" class="txt" style="width:85px" title="앞자리 입력" name="extMbrEmlPrx" id="extMbrEmlPrx"/>
                        <span class="in-input">@</span>
                        <input type="text" class="txt" style="width:85px" title="뒷자리 입력" name="extMbrEmlTail" id="extMbrEmlTail"/>
                        <select class="select select-type1" style="width:137px;" name="selectEmlTail"  id="selectEmlTail" onchange="svrcomChg()" >
                            <option value="" selected>직접입력</option>
                            <option value="naver.com">naver.com</option>
                            <option value="nate.com">nate.com</option>
                            <option value="gmail.com">gmail.com</option>
                            <option value="chol.com">chol.com</option>
                            <option value="dreamwiz.com">dreamwiz.com</option>
                            <option value="empal.com">empal.com</option>
                            <option value="korea.com">korea.com</option>
                            <option value="hotmail.com">hotmail.com</option>
                        </select>
                    </td>
                </tr>
                </tbody>
                </table>
            </div>
        </div>
        <div class="btnwrap">
            <a href="#"><img src="/kr/images/layerpopup/btn_confirm04.gif" alt="확인"  onClick="extPwFindAction()"/></a>
        </div>
    </div>
    <!-- close -->
    <div class="close-area"><div class="close-area-inner">
        <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
    </div></div>
    <!-- //close -->
</div></div>

 

<div id="pwfindpopup02" class="layerpopup idfindpopup"><div class="layerpopup-inner">
    <div class="layerpopup-head">
        <h1><img src="/kr/images/layerpopup/h1_pwfind.gif" alt="비밀번호 찾기" /></h1>
        <p class="desc"><img src="/kr/images/layerpopup/h1_pwfind_desc.gif" alt="회원 아이디, 이메일 주소가 모두 일치하는 경우 해당 메일로 임시 비밀번호를 발급해 드립니다." /></p>
    </div>
    <div class="layerpopup-contents">
        <div class="person-info-wrap">
            <p class="idfind-result" name="pwFindMsg" id="pwFindMsg">
               
            </p>
            <p class="subsection04"><img src="/kr/images/layerpopup/txt_idfind01.gif" alt="고객님의 개인정보는 항상 암호화 되어 처리되며, 본인 확인용으로만 사용합니다. 아이디/비밀번호 찾기가 위의 방법으로 불가능하신 경우 고객센터 (080-600-6000) 로 문의해 주시기 바랍니다." /></p>
        </div>
        <div class="btnwrap">
            <a href="#"><img src="/kr/images/layerpopup/btn_confirm04.gif" alt="확인" class="close"/></a>
        </div>
    </div>
    <!-- close -->
    <div class="close-area"><div class="close-area-inner">
        <img src="/kr/images/layerpopup/btn_close.gif" alt="닫기" class="close" />
    </div></div>
    <!-- //close -->
</div></div>

 
<div id="wrap" class="non-subnavigation02">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <%@ include file="/WEB-INF/jsp/com/include/sub_header_global02_type02.jspf" %>
    <hr />


	<div id="container">
		<div id="subtitle-area"><div class="subtitle-area-inner">
			<%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
		</div></div>
        <input type="hidden" name="extMbrNm" id="extMbrNm" value="">
        <input type="hidden" name="extHpNo"  id="extHpNo"  value="">
        <input type="hidden" name="extMbrEml" id="extMbrEml" value="">
        <input type="hidden" name="extMbrId"  id="extMbrId" value=""> 
        <div id="article">
			<p><img src="/kr/images/global_menu/txt_global_menu_login02_01.gif" alt="신 회원제 전환을 위해 기존 아이디와 패스워드를 입력해주세요." /></p>
			<div class="login-input-wrap">
				<div class="login-input"><div class="login-input-inner">
					<p>
						<img src="/kr/images/global_menu/txt_global_menu_login02_02.gif" alt="아이디" />
						<input type="text" class="txt" style="width:164px;" name="extId" id="extId"/>
					</p>
					<p class="password">
						<img src="/kr/images/global_menu/txt_global_menu_login03.gif" alt="비밀번호" />
						<input type="password" class="txt" style="width:164px;" name="extPw" id="extPw" />
					</p>
					<input type="image" src="/kr/images/common/button/btn_confirm02.gif" class="login-btn" alt="확인" onClick="extFncLogin()" />
					<div class="etc-function">
						<a href="#idfindpopup" class="layer-control">아이디 찾기</a>
						<span class="bar">|</span>
						<a href="#pwfindpopup" class="layer-control">비밀번호 찾기</a>
					</div>
                    <div id="loginMsg" name="loginMsg"></div>
				</div></div>
			</div>
		</div>
    <div id="extIdFindPopUp" style="display:none"></div> 
    

    
       
    <div id="extIdFindRstPopUp" style="display:none"></div>  
    <div id="extPwFindPopUp" style="display:none"></div>         
    <div id="extPwFindRstPopUp" style="display:none"></div>  
        </form>
        


	<hr />
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>